<?php
/**
 * 功能描述：	系统模型管理
 * @datetime	2022-07-10
 * @version   	v2.3.0
 * @author   	ZHL
 * @copyrigh  	2022 ZHL 版权所有
 */

class Admin_MouldController extends Controller {

    // 是否登录
    function __construct($controller, $action) {
        parent::__construct($controller, $action);
        $loginSer = new Admin_LoginServe();
        $loginSer->judgeSessionLogin($controller, $action);
    }

    /**
     * Notes:模型列表页
     * User: ZhuHaili
     */
    function index(){
		$modelSer = new Admin_MouldServe();
		$list = $modelSer->getMouldsList();
		$this->set('list', $list);
        $this->set('title', '模型分类列表');
		$this->display();
    }

    /**
     * Notes:添加模型
     * User: ZhuHaili
     */
    function add(){
        $subFlag = Fun::input('subFlag');
        if($subFlag == 'Y') {
            $param = Fun::input();
            $modelSer = new Admin_MouldServe();
            $result = $modelSer->addMoulds($param);
            Fun::json($result, true);
        }
        $this->set('title', '添加模型');
        $this->display();
    }

    /**
     * Notes:修改模型
     * User: ZhuHaili
     * Date: 菜单
     */
    function update(){
        $subFlag = Fun::input('subFlag');
        $modelSer = new Admin_MouldServe();
        if($subFlag == 'Y') {
            $param = Fun::input();
            $result = $modelSer->updateMoulds($param);
            Fun::json($result, true);
        }
        $id = Fun::input('id');
        $info = $modelSer->getMouldsInfo($id);
        $this->set('info', $info);
        $this->set('title', '修改模型');
        $this->display();
    }

    /**
     * Notes:删除模型
     * User: ZhuHaili
     * Date: 菜单
     */
    function del(){
        $id = Fun::input('id');
        $modelSer = new Admin_MouldServe();
        $result = $modelSer->delMoulds($id);
        Fun::json($result, true);
    }

    /**
     * Notes: 排序
     * User: ZhuHaili
     * Date: 2022/7/10
     */
    function seq(){
        $param = Fun::input('param');
        $modelSer = new Admin_MouldServe();
        $result = $modelSer->seqMoulds('sysmould', $param);
        Fun::json($result, true);
    }
}